<template>
  <div class="public_main">
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>{{$t('sidebar.dataReport')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('newcrumbs.crumbsSev')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('loanAfterManage.crumbsNine')}}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <!-- -------------搜索查询栏------------------------ -->
    <search 
			:searchData="searchData" 
			@search="search" 
			:searchRight="true"
			:outputRight="false"
    ></search>
    <!-- -------------表单显示栏------------------------ -->
    <!-- <div class="table" v-if="$store.state.common.permiss.includes('RIGHT_ACCOUNT_LENDING_LIST')"> -->
    <div class="table">
      <template>
        <el-table :data="tableData" stripe size="small" v-loading="loadFlag">
          <el-table-column align="center" prop="date" :label="$t('public.no33')"></el-table-column>
          <el-table-column align="center" prop="adminName" :label="$t('loanAfterManage.name')"></el-table-column>
          <el-table-column align="center" prop="distribution" :label="$t('loanAfterManage.no4')"></el-table-column>
          <el-table-column align="center" prop="transfer" :label="$t('loanAfterManage.zhuanpailiang')"></el-table-column>
          <el-table-column align="center" prop="amount" :label="$t('totalManage.returnMoney')">
            <template slot-scope="scope">
              <span>{{$store.state.common.id_currency}}{{$store.getters.moneySplit(scope.row.amount)}}{{$store.state.common.vi_currency}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="collection" :label="$t('loanAfterManage.no5')"></el-table-column>
          <el-table-column align="center" prop="collectionAmount" :label="$t('loanAfterManage.no6')"></el-table-column>
        </el-table>
      </template>
    </div>
    <!-- ------------  分页显示栏  ------------------------ -->
    <el-row type="flex" justify="end">
      <div class="pages" >
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="pagination.current"
          layout="sizes, prev, pager, next, total,->"
          :page-sizes="pagination.pageSizeOptions"
          :page-size="pagination.pageSize"
          @size-change="handleSizeChange"
          :total="pagination.total">
        </el-pagination>
      </div>
    </el-row>
    <div class="foot"></div>

  </div>
</template>
<script>
import getGroupMem from 'src/mixins/getGroupMem.js';
export default {
  name: 'dayReportList',
  mixins:[getGroupMem],
  data () {
    const searchData=[
      {
        type: 'rangePicker',
        label: 'channelData.no1',
        attr: 'searchTime',
        value: [],
      }, {
        type: 'select',
        attr: 'adminId',
        label: 'loanAfterManage.name',
        option: [],
        value: '',
        langFlag: false
      }]
    return {
      flag: true,
      loadFlag: true,
      pagination: {
        pageSize: global.config.pageSize,
        pageSizeOptions: global.config.pageSizeOptions,
        current: 1,
        total: 0,
      },
      searchData:searchData,
      formInline: {},// 用户查询信息数据对应字段
      tableData: []// 用户信息数据模拟
    }
  },
  methods: {
    handleSizeChange (val) {// 每页条数变化时操作
      this.pagination.pageSize = val;
      this.getTableData();
    },
    handleCurrentChange (val) { // 分页按钮点击操作
      this.pagination.current = val;
      this.getTableData();
    },
    search(search) { // 搜索
      this.formInline = {
        adminId: search.adminId,
        beginTime:search.searchTime?search.searchTime[0]:'',
        endTime:search.searchTime?search.searchTime[1]:'',
      };
      if (this.flag) {
        this.pagination.currentPage = 1;
        this.flag = false;
        this.getTableData();
      }
      
    },
    getTableData () { // 放款列表获取
      this.loadFlag = true;
      let option = {
        pageNum:this.pagination.current,
        pageSize:this.pagination.pageSize,
        param: {
          ...this.formInline
        }       
      }
      this.$axios.post(this.$action.collection_reportlist, option).then(res => {
        this.flag = true;
        if (res.code == 200) {
          this.tableData = res.data.list;
          this.pagination.total = res.data.total;
        }else{
          this.$globalMsg.error(res.message)
        }
        this.loadFlag = false;
      })
    }
  },
  mounted () {
    this.getGroupMem(3).then(arr=>{
      this.searchData[1].option=arr;
    })
    this.getTableData();
  }
}
</script>
<style scoped lang="scss"></style>
